package com.learn.eduadboot.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.learn.eduapi.entity.ad.PromotionAd;
import com.learn.eduapi.entity.ad.PromotionSpace;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface PromotionAdMapper extends BaseMapper<PromotionAd> {
    /**
     * 通过广告位查询广告列表
     * @param sid
     * @return
     */
    @Select("select * from promotion_ad where space_id = #{space_id}")
    List<PromotionAd> getAdsBySpaceId(@Param("space_id") Integer sid);

    /**
     * 后台广告详情列表
     * @param find
     * @param page
     * @param size
     * @return
     */
    List<PromotionAd> getAllPromotionAd(@Param("find")String find,@Param("page")Integer page,@Param("size")Integer size);
    @Select("select * from promotion_ad where name = #{name}")
    PromotionAd selectByName(@Param("name")String name);
}
